package com.am.mosl.cityandroid.login;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import net.tsz.afinal.FinalHttp;
import net.tsz.afinal.http.AjaxCallBack;
import net.tsz.afinal.http.AjaxParams;

import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import cn.jpush.android.api.JPushInterface;

import com.alibaba.fastjson.JSON;
import com.am.mosl.cityandroid.R;
import com.am.mosl.cityandroid.activity.BaseActivity;
import com.am.mosl.cityandroid.bean.Account;
import com.am.mosl.cityandroid.bean.AccountBean;
import com.am.mosl.cityandroid.constant.HttpConstant;
import com.am.mosl.cityandroid.message.LoginMessage;
import com.am.mosl.cityandroid.util.SettingUtils;
import com.nostra13.universalimageloader.core.ImageLoader;

import de.greenrobot.event.EventBus;

/**
 * @author 邓思宇 登入界面
 * 
 */
@SuppressLint("ResourceAsColor")
public class NewAccountActivity extends BaseActivity {

	private TextView sex_text;
	private ImageView faceImage;
	private String phoneNum;
	private String verifyNum;
	private EditText NickName;
	private EditText CityName;
	private EditText Password1;
	private EditText Password2;
	private TextView XIUGAI;
	private Button login_finish;
	private ProgressDialog mDialog;
	private Bitmap bmp = null;
	private ImageView mm_head;
	private View sex_change;
	private String TokenNow;
	private String picturePath;// 暂时保存的头像位置
	private String personal;// 这个是用来判定当前是否为修改栏目
	private String[] items = new String[] { "男", "女" };
	private String[] items2 = new String[] { "手机相册", "相机拍摄" };

	/* 请求码 */
	private static final int IMAGE_REQUEST_CODE = 0;
	private static final int CAMERA_REQUEST_CODE = 1;
	private static final int RESULT_REQUEST_CODE = 2;
	private static final int RESULT_CAMERA_CODE = 3;

	private Uri imageFileUri;

	@SuppressLint("HandlerLeak")
	private Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case 1:

				break;

			case 2:

				Toast.makeText(NewAccountActivity.this, "没上传头像",
						Toast.LENGTH_SHORT).show();

				break;

			case 3:

				try {
					changeHead(picturePath);
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				break;

			}
		};
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.z_info_activity);

		// 设定默认的头像路径
		picturePath = "file:///android_asset/avatar_default.png";

		// 获取到上一个页面得来的手机号码值和验证码值
		Bundle extras = getIntent().getExtras();
		personal = extras.getString("Personal");
		phoneNum = extras.getString("Phone");
		verifyNum = extras.getString("Verify");

		sex_text = (TextView) findViewById(R.id.sex_text);
		NickName = (EditText) findViewById(R.id.NickName);
		CityName = (EditText) findViewById(R.id.CityName);
		Password1 = (EditText) findViewById(R.id.Password1);
		Password2 = (EditText) findViewById(R.id.Password2);
		login_finish = (Button) findViewById(R.id.login_finish);
		sex_change = (View) findViewById(R.id.sex_change);
		mm_head = (ImageView) findViewById(R.id.m_head);
		XIUGAI = (TextView) findViewById(R.id.right_tittle);

		if (personal.equals("0")) {

			initBar();

			// 点击完成按钮
			login_finish.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					try {
						Signin();
					} catch (FileNotFoundException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			});
		}

		else if (personal.equals("1")) {

			try {
				showPerson();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	// 点击修改
	public void BacktoWrite(View view) {

		NickName.setEnabled(true);
		NickName.requestFocus();
		InputMethodManager imm = (InputMethodManager) NickName.getContext()
				.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
		CityName.setEnabled(true);
		sex_change.setClickable(true);

		if (XIUGAI.getText().toString().trim().equals("完成")) {
			ChangeInfo();
		}

		XIUGAI.setText("完成");

	}

	// 展示个人资料的方法
	private void showPerson() throws IOException {
		// TODO Auto-generated method stub

		// 按钮与ACTIONBAR的修改
		XIUGAI.setText("修改");

		TextView title = (TextView) findViewById(R.id.tittle);
		title.setText("个人资料");

		// 隐藏密码栏目
		View code_bar = (LinearLayout) findViewById(R.id.code_bar);
		code_bar.setVisibility(View.GONE);

		View buttonf = (Button) findViewById(R.id.login_finish);
		buttonf.setVisibility(View.GONE);

		AccountBean accountBean = new AccountBean();
		accountBean = SettingUtils.getUserInfo(NewAccountActivity.this);

		NickName.setText(accountBean.data.getName());
		NickName.setEnabled(false);
		CityName.setText(accountBean.data.getCity());
		CityName.setEnabled(false);
		sex_text.setText(accountBean.data.getSex());
		sex_change.setClickable(false);

		SetHeadIcon();

	}

	public void ChangeInfo() {

		final String nickname = NickName.getText().toString().trim();
		final String cityname = CityName.getText().toString().trim();
		final String sexname = sex_text.getText().toString().trim();

		AccountBean accountBean = new AccountBean();
		accountBean = SettingUtils.getUserInfo(NewAccountActivity.this);
		String token = accountBean.getToken();

		// TODO Auto-generated method stub
		if (isNetworkAvailable(NewAccountActivity.this)) {
			FinalHttp finalHttp = new FinalHttp();
			AjaxParams params = new AjaxParams();
			params.put("token", token);
			params.put("name", nickname);
			params.put("city", cityname);
			params.put("sex", sexname);

			finalHttp.post(HttpConstant.UpdateInfo, params,
					new AjaxCallBack<Object>() {
						@Override
						public boolean isProgress() {
							return super.isProgress();
						}

						@Override
						public void onSuccess(Object o) {
							super.onSuccess(o);
							try {
								JSONObject jsonObject = new JSONObject(o
										.toString());
								String status = (String) jsonObject
										.opt("status");
								String msg = (String) jsonObject.opt("msg");

								if (status.equals("1")) {

									AccountBean accountBean = new AccountBean();
									accountBean = SettingUtils
											.getUserInfo(NewAccountActivity.this);

									accountBean.data.setName(nickname);
									accountBean.data.setCity(cityname);
									accountBean.data.setSex(sexname);

									SettingUtils.saveUserInfo(
											NewAccountActivity.this,
											accountBean);

									LoginMessage message = new LoginMessage();
									message.setType(1);
									EventBus.getDefault().post(message);

									NewAccountActivity.this.finish();

								}

								else if (status.equals("2")) {

									SettingUtils
											.RemoveAccount(NewAccountActivity.this);
									LoginMessage message = new LoginMessage();
									message.setType(LoginMessage.QUIT);
									EventBus.getDefault().post(message);

									Toast.makeText(NewAccountActivity.this,
											"帐号验证失败，请重新登录", Toast.LENGTH_SHORT)
											.show();
									NewAccountActivity.this.finish();
								} else {
									Toast.makeText(NewAccountActivity.this,
											"更改失败：" + msg, Toast.LENGTH_SHORT)
											.show();
									NewAccountActivity.this.finish();
								}

							} catch (JSONException e) {
								e.printStackTrace();
							}
						}

					});

		} else {
			Toast.makeText(NewAccountActivity.this, "网络未连接", Toast.LENGTH_SHORT)
					.show();
		}

	}

	public void SetHeadIcon() {
		String headhttp = SettingUtils.getUserInfo(NewAccountActivity.this)
				.getData().getHead_img();
		if (headhttp == null) {

		} else {
			ImageLoader.getInstance().displayImage(
					SettingUtils.getUserInfo(NewAccountActivity.this).getData()
							.getHead_img(), mm_head);
		}
	}

	// 点击设置头像
	@SuppressLint("ResourceAsColor")
	public void iconChangeClick(View view) {
		showDialog();

	}

	// 点击设置性别
	public void sexChangeClick(View view) {

		new AlertDialog.Builder(this).setItems(items,
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						switch (which) {
						case 0:
							sex_text.setTextColor(R.color.black);
							sex_text.setText("男");
							break;
						case 1:
							sex_text.setTextColor(R.color.black);
							sex_text.setText("女");
							break;
						}
					}
				}).show();

	}

	// 弹出设置头像对话框
	/**
	 * 显示选择对话框
	 */
	private void showDialog() {

		new AlertDialog.Builder(NewAccountActivity.this).setItems(items2,
				new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {
						switch (which) {
						case 0:
							Intent choosePictureIntent = new Intent(
									Intent.ACTION_PICK,
									android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
							startActivityForResult(choosePictureIntent,
									IMAGE_REQUEST_CODE);
							break;
						case 1:
							imageFileUri = NewAccountActivity.this
									.getContentResolver()
									.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
											new ContentValues());
							if (imageFileUri != null) {
								Intent i = new Intent(
										android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
								i.putExtra(
										android.provider.MediaStore.EXTRA_OUTPUT,
										imageFileUri);
								startActivityForResult(i, CAMERA_REQUEST_CODE);
							} else {
								Toast.makeText(NewAccountActivity.this, "出现异常",
										Toast.LENGTH_SHORT).show();
							}
							break;
						}
					}
				}).show();

	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		// 结果码不等于取消时候
		if (resultCode != 0) {

			switch (requestCode) {
			case IMAGE_REQUEST_CODE:
				startPhotoZoom(data.getData());
				break;
			case CAMERA_REQUEST_CODE:
				/*
				 * if (hasSdcard()) { File tempFile = new File(Environment
				 * .getExternalStorageDirectory() + IMAGE_FILE_NAME);
				 * startPhotoZoom(Uri.fromFile(tempFile)); } else {
				 * Toast.makeText(getActivity(), "未找到存储卡，无法存储照片！",
				 * Toast.LENGTH_LONG).show(); }
				 */
				startCameraZoom(imageFileUri);
				break;
			case RESULT_REQUEST_CODE:
				if (data != null) {
					// Uri imageFileUri = data.getData();
					// picPath = getPicPathFromUri(imageFileUri);
					// changeHead(picPath);
					try {
						getImageToView(data);
					} catch (FileNotFoundException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			case RESULT_CAMERA_CODE:
				if (data != null) {
					try {
						getImageToView(data);
					} catch (FileNotFoundException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
				break;
			}
		}
		super.onActivityResult(requestCode, resultCode, data);
	}

	/**
	 * 裁剪图片方法实现
	 * 
	 * @param uri
	 */
	public void startPhotoZoom(Uri uri) {

		Intent intent = new Intent("com.android.camera.action.CROP");
		intent.setDataAndType(uri, "image/*");
		// 设置裁剪
		intent.putExtra("crop", "true");
		// aspectX aspectY 是宽高的比例
		intent.putExtra("aspectX", 1);
		intent.putExtra("aspectY", 1);
		// outputX outputY 是裁剪图片宽高
		intent.putExtra("outputX", 320);
		intent.putExtra("outputY", 320);
		intent.putExtra("return-data", true);
		startActivityForResult(intent, 2);
	}

	public void startCameraZoom(Uri uri) {

		Intent intent = new Intent("com.android.camera.action.CROP");
		intent.setDataAndType(uri, "image/*");
		// 设置裁剪
		intent.putExtra("crop", "true");
		// aspectX aspectY 是宽高的比例
		intent.putExtra("aspectX", 1);
		intent.putExtra("aspectY", 1);
		// outputX outputY 是裁剪图片宽高
		intent.putExtra("outputX", 320);
		intent.putExtra("outputY", 320);
		intent.putExtra("return-data", true);
		startActivityForResult(intent, RESULT_CAMERA_CODE);
	}

	/**
	 * 保存裁剪之后的图片数据
	 * 
	 * @param picdata
	 * @throws FileNotFoundException
	 */
	private void getImageToView(Intent data) throws FileNotFoundException {
		Bundle extras = data.getExtras();
		if (extras != null) {
			Bitmap photo = extras.getParcelable("data");
			Drawable drawable = new BitmapDrawable(photo);

			Uri imageFileUri;
			if (data.getData() != null) {
				imageFileUri = data.getData();
			} else {
				imageFileUri = Uri.parse(MediaStore.Images.Media.insertImage(
						NewAccountActivity.this.getContentResolver(), photo,
						null, null));
			}
			Log.d("uri is null？", (imageFileUri == null) + "");

			String picPath = getPicPathFromUri(imageFileUri);
			InputStream fis;
			try {
				fis = new FileInputStream(picPath);
				BitmapFactory.Options opts = new BitmapFactory.Options();
				opts.inTempStorage = new byte[100 * 1024];// 100kb缓存
				opts.inPreferredConfig = Bitmap.Config.RGB_565;
				opts.inPurgeable = true;// 可被回收
				opts.inSampleSize = 4;
				opts.inInputShareable = true;
				Bitmap btp = BitmapFactory.decodeStream(fis, null, opts);
				faceImage = (ImageView) NewAccountActivity.this
						.findViewById(R.id.m_head);
				faceImage.setImageBitmap(btp);
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			picturePath = picPath;

			// 点击个人资料里面的修改头像按钮则单独出来
			if (personal.equals("1")) {

				try {
					changeHead(picturePath);
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}

		}
	}

	/**
	 * 检查是否存在SDCard
	 * 
	 * @return
	 */
	public boolean hasSdcard() {
		String state = Environment.getExternalStorageState();
		if (state.equals(Environment.MEDIA_MOUNTED)) {
			return true;
		} else {
			return false;
		}

	}

	private String getPicPathFromUri(Uri uri) {
		String value = uri.getPath();
		if (value.startsWith("/external")) {
			String[] proj = { MediaStore.Images.Media.DATA };
			@SuppressWarnings("deprecation")
			Cursor cursor = NewAccountActivity.this.managedQuery(uri, proj,
					null, null, null);
			int column_index = cursor
					.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
			cursor.moveToFirst();
			return cursor.getString(column_index);
		} else {
			return value;
		}
	}

	// 上传头像到数据库
	private void changeHead(final String head) throws FileNotFoundException {

		if (isNetworkAvailable(NewAccountActivity.this)) {
			FinalHttp finalHttp = new FinalHttp();
			AjaxParams params = new AjaxParams();

			AccountBean accountBean = new AccountBean();
			accountBean = SettingUtils.getUserInfo(NewAccountActivity.this);
			String token = accountBean.getToken();

			params.put("token", token);
			params.put("headimage", new File(head));

			finalHttp.post(HttpConstant.ChangeHeadImage, params,
					new AjaxCallBack<Object>() {
						@Override
						public boolean isProgress() {
							return super.isProgress();
						}

						@Override
						public void onSuccess(Object o) {
							super.onSuccess(o);
							try {
								JSONObject jsonObject = new JSONObject(o
										.toString());
								String status = (String) jsonObject
										.opt("status");
								String msg = (String) jsonObject.opt("msg");

								String head_url = (String) jsonObject
										.opt("url");

								// 点击个人资料里面的修改头像按钮则单独出来
								if (status.equals("1")) {

									AccountBean accountBean = new AccountBean();
									accountBean = SettingUtils
											.getUserInfo(NewAccountActivity.this);

									accountBean.data.setHead_img(head_url);

									SettingUtils.saveUserInfo(
											NewAccountActivity.this,
											accountBean);

									LoginMessage message = new LoginMessage();
									message.setType(1);
									EventBus.getDefault().post(message);

								} 
								
								else if (status.equals("2")) {

									SettingUtils
											.RemoveAccount(NewAccountActivity.this);
									LoginMessage message = new LoginMessage();
									message.setType(LoginMessage.QUIT);
									EventBus.getDefault().post(message);

									Toast.makeText(NewAccountActivity.this,
											"帐号验证失败，请重新登录", Toast.LENGTH_SHORT)
											.show();
									NewAccountActivity.this.finish();
								}
								
								else {
									Toast.makeText(NewAccountActivity.this,
											"头像上传失败：" + msg, Toast.LENGTH_SHORT)
											.show();
								}

							} catch (JSONException e) {
								e.printStackTrace();
							}
						}
					});

		} else {
			Toast.makeText(NewAccountActivity.this, "网络未连接", Toast.LENGTH_SHORT)
					.show();
		}

	}

	/**
	 * 判断网络是否可用
	 * 
	 */
	public static boolean isNetworkAvailable(Context context) {
		ConnectivityManager mgr = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo[] info = mgr.getAllNetworkInfo();
		if (info != null) {
			for (int i = 0; i < info.length; i++) {
				if (info[i].getState() == NetworkInfo.State.CONNECTED) {
					return true;
				}
			}
		}
		return false;
	}

	// 完成注册的方法
	private void Signin() throws FileNotFoundException {

		final String nickname = NickName.getText().toString().trim();
		final String cityname = CityName.getText().toString().trim();
		final String sex = sex_text.getText().toString().trim();
		final String password1 = Password1.getText().toString().trim();
		final String password2 = Password2.getText().toString().trim();

		if (nickname.equals("")) {
			Toast.makeText(NewAccountActivity.this, "昵称不能为空",
					Toast.LENGTH_SHORT).show();
			return;
		}

		if (cityname.equals("")) {
			Toast.makeText(NewAccountActivity.this, "城市不能为空",
					Toast.LENGTH_SHORT).show();
			return;
		}

		if (!(sex.equals("男") || sex.equals("女"))) {
			Toast.makeText(NewAccountActivity.this, "性别不能为空",
					Toast.LENGTH_SHORT).show();
			return;
		}

		if (password1.equals("") || password2.equals("")) {
			Toast.makeText(NewAccountActivity.this, "密码不能为空",
					Toast.LENGTH_SHORT).show();
			return;
		}

		if ((password1.length() < 6) || (password2.length() < 6)) {
			Toast.makeText(NewAccountActivity.this, "密码长度不能小于6位",
					Toast.LENGTH_SHORT).show();
			return;
		}

		if (!password1.equals(password2)) {
			Toast.makeText(NewAccountActivity.this, "两次输入密码不一致",
					Toast.LENGTH_SHORT).show();
			return;
		}

		// 注册一个新用户

		if (isNetworkAvailable(NewAccountActivity.this)) {

			mDialog = ProgressDialog.show(NewAccountActivity.this, "",
					"正在注册新用户...", true);

			FinalHttp finalHttp = new FinalHttp();
			AjaxParams params = new AjaxParams();
			final String telephoneNum = phoneNum;
			final String verityNum = verifyNum;
			params.put("telephone", telephoneNum);
			params.put("verifycode", verityNum);
			params.put("password", password1);
			params.put("name", nickname);
			params.put("city", cityname);
			params.put("sex", sex);

			Log.d("Send message", telephoneNum + " " + verityNum + " "
					+ password1 + " " + nickname + " " + cityname + " " + sex);

			finalHttp.post(HttpConstant.Register, params,
					new AjaxCallBack<Object>() {
						@Override
						public boolean isProgress() {
							return super.isProgress();
						}

						@Override
						public void onSuccess(Object o) {
							super.onSuccess(o);
							try {
								JSONObject jsonObject = new JSONObject(o
										.toString());
								String status = (String) jsonObject
										.opt("status");
								String msg = (String) jsonObject.opt("msg");

								if (mDialog != null) {
									mDialog.dismiss();
								}

								if (status.equals("1")) {
									Message message = new Message();
									message.what = 1;
									mHandler.sendMessage(message);

									Login(telephoneNum, password1);

								} else {
									Message message = new Message();
									message.what = 2;
									mHandler.sendMessage(message);
								}

							} catch (JSONException e) {
								e.printStackTrace();
							}
						}
					});

		} else {
			Toast.makeText(NewAccountActivity.this, "网络未连接", Toast.LENGTH_SHORT)
					.show();
		}

	}

	private void initBar() {

		TextView title = (TextView) findViewById(R.id.tittle);
		title.setText("填写个人资料");

		if (personal.equals("0")) {
			View right_title = (TextView) findViewById(R.id.right_tittle);
			right_title.setVisibility(View.GONE);
		}

	}

	// 点击返回
	public void BackToBack(View view) {
		this.finish();
	}

	// 调用登录接口 注册完之后直接登录
	protected void Login(final String loginphone, final String logincode) {
		// TODO Auto-generated method stub
		if (isNetworkAvailable(NewAccountActivity.this)) {
			FinalHttp finalHttp = new FinalHttp();
			AjaxParams params = new AjaxParams();
			params.put("telephone", loginphone);
			params.put("password", logincode);

			finalHttp.post(HttpConstant.Login, params,
					new AjaxCallBack<Object>() {
						@Override
						public boolean isProgress() {
							return super.isProgress();
						}

						@Override
						public void onSuccess(Object o) {
							super.onSuccess(o);
							try {
								JSONObject jsonObject = new JSONObject(o
										.toString());
								String status = (String) jsonObject
										.opt("status");
								String msg = (String) jsonObject.opt("msg");
								String token = (String) jsonObject.opt("token");

								Account data1 = JSON.parseObject(
										jsonObject.toString(), Account.class);

								saveUserInfo(token, data1, loginphone);

								// 设置别名用的
								JPushInterface.setAlias(
										NewAccountActivity.this, data1
												.getData().getUid(), null);

								if (status.equals("1")) {

									Message message1 = new Message();
									message1.what = 3;
									mHandler.sendMessage(message1);

									LoginMessage message = new LoginMessage();
									message.setType(1);
									EventBus.getDefault().post(message);

									LoginActivity.h.sendEmptyMessage(0);
									ForgetActivity.h.sendEmptyMessage(0);
									VertifyActivity.h.sendEmptyMessage(0);

									NewAccountActivity.this.finish();

								} else {
									Toast.makeText(NewAccountActivity.this,
											"登录失败：" + msg, Toast.LENGTH_SHORT)
											.show();
								}

							} catch (JSONException e) {
								e.printStackTrace();
							}
						}
					});

		} else {
			Toast.makeText(NewAccountActivity.this, "网络未连接", Toast.LENGTH_SHORT)
					.show();
		}

	}

	private void saveUserInfo(String token, Account data, String telephone) {

		AccountBean accountBean = new AccountBean();
		accountBean.setToken(token);
		accountBean.setData(data.getData());
		accountBean.data.setPhone(telephone);
		SettingUtils.saveUserInfo(NewAccountActivity.this, accountBean);

	}

}